package com.lvtongka.app.common.widget

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

/**
 * describe:
 *
 * @author:ZhangWei(张伟)
 * date:2024/11/3
 * time:19:01
 */
class SpacesItemDecoration(val space: Int) : RecyclerView.ItemDecoration()  {

    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        outRect.left = space;
        outRect.right = space;
        outRect.bottom = space;
        if (parent.getChildLayoutPosition(view) == 0) {
            outRect.top = space;
        }
    }
}